import React, { useEffect, useState } from 'react';
import { Space, Table, Input } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { getServelist } from '@/api/getToutist';
import { addTable } from '@/pages/hoc/table.js';

interface DataType {
  key: string;
  name: string;
  age: number;
  address: string;
  tags: string[];
}

const columns: ColumnsType<DataType> = [
  {
    title: 'ID',
    dataIndex: 'vsid',
    key: 'vsid',
  },
  {
    title: '游客id',
    dataIndex: 'visitor_id',
    key: 'visitor_id',
  },
  {
    title: '游客名称',
    dataIndex: 'visitor_name',
    key: 'visitor_name',
  },

  {
    title: 'IP',
    dataIndex: 'visitor_ip',
    key: 'visitor_ip',
  },
  {
    title: '接待客服',
    dataIndex: 'kefu_name',
    key: 'kefu_name',
  },
  {
    title: '开始时间',
    dataIndex: 'start_date',
    key: 'start_date',
  },
  {
    title: '结束时间',
    dataIndex: 'end_date',
    key: 'end_date',
    render: (item) => {
      // console.log(item, 'item');
      return item ? item : '无';
    },
  },
];

const Serve = (props: any) => {
  // console.log(props);
  let { data, count } = props;
  return (
    <div>
      <Table
        pagination={{
          total: count,
          pageSize: 8,
          showQuickJumper: true,
        }}
        columns={columns}
        dataSource={data}
      ></Table>
    </div>
  );
};

export default addTable(getServelist)(Serve);
